home *** CD-ROM | disk | FTP | other *** search
/ CD World Haziran 1997 / CD World Haziran 1997.iso / Explorer Yardimcilari / PiXCL Tools / Draw.px_ / Draw.px
Encoding:
Text File  |  1996-08-06  |  18.1 KB  |  685 lines

  1. {------------------------------DRAW.pxl-------------------------------
  2.  This script lets you draw a variety of graphic shapes by clicking on
  3.  various points in the window.
  4.  
  5.  Sample PiXCL 4.0 application. Code can be re-used.
  6.  --------------------------------------------------------------------}
  7. Initialize:
  8.     WinGetActive(Windowname$)
  9.     WinVersion(Major,Minor,Build)
  10.     InfoMenu(REMOVE)
  11.     {Establish Default Environment}
  12.  
  13.     Title$ = "Pixcl 4.0 Draw"
  14.     WinTitle(Windowname$,Title$)
  15.     UseCoordinates(PIXEL)
  16.     WinLocate(Title$,20,10,780,560,Res)
  17.     WinShow(Title$,TOPMOST,Res)
  18.  
  19. Restart:
  20.        UseCoordinates(METRIC)
  21.        UsePen(SOLID,3,0,0,0)
  22.        P_Red = 0
  23.        P_Green = 0
  24.        P_Blue = 0
  25.        UseBrush(SOLID,255,0,0)
  26.        Br_Red = 255
  27.        Br_Green = 0
  28.        Br_Blue = 0
  29.        Current_Fig$ = "&Line"
  30.        Previous_Fig$ = Current_Fig$
  31.        Current_Pen$ = "Blac&k "
  32.        Previous_Pen$ = "Blac&k "
  33.        Current_Brush$ = "&Red"
  34.        Previous_Brush$ = "&Red"
  35.    
  36.        UseBackground(OPAQUE,255,255,255)
  37.        DrawBackground
  38.        DrawLine(0,130,280,130)
  39.  
  40. Draw_Menu:
  41.     WaitInput(100)
  42.        SetMenu("&Exit!",Exit_proc,
  43.             ENDPOPUP,
  44.         "&Figures",IGNORE,
  45.               "&Line",     DR_LINE,
  46.                   "&Rectangle",DR_RECTANGLE,
  47.                   "&Round Rectangle",  DR_ROUNDR,
  48.                   "&Ellipse",  DR_ELLIPSE,
  49.               "&Pie",      DR_PIE,
  50.                    "&Arc",      DR_ARC,
  51.               "&Chord",    DR_CHORD,
  52.               ENDPOPUP,
  53.             "&Brush Color",IGNORE,
  54.               "&White",    BRUSH_WHITE,
  55.               "&Gray",     BRUSH_GRAY,
  56.               "&Red",      BRUSH_RED,
  57.               "&Yellow",   BRUSH_YEL,
  58.               "Gree&n",    BRUSH_GRN,
  59.               "&Light Blue", BRUSH_LTBLU,
  60.               "&Blue",     BRUSH_BLUE,
  61.               "&Pink",     BRUSH_PINK,
  62.               "Blac&k",    BRUSH_BLACK,
  63.             ENDPOPUP,
  64.             "&Pen Color",IGNORE,
  65.               "&White ",    Pen_WHITE,
  66.               "&Gray ",     Pen_GRAY,
  67.               "&Red ",      Pen_RED,
  68.               "&Yellow ",   Pen_YEL,
  69.               "Gree&n ",    Pen_GRN,
  70.               "&Light Blue ",  Pen_LTBLU,
  71.               "&Blue ",     Pen_BLUE,
  72.               "&Pink ",     Pen_PINK,
  73.               "Blac&k ",    Pen_BLACK,
  74.             ENDPOPUP,
  75.         "&Clear Client Area",Restart,
  76.         ENDPOPUP)
  77.  
  78.     ChangeMenuItem(Current_Fig$,CHECK,temp)
  79.     ChangeMenuItem(Current_Pen$,CHECK,temp)
  80.     ChangeMenuItem(Current_Brush$,CHECK,temp)
  81.  
  82. {Draw tool boxes}
  83.        Gosub Draw_Boxes
  84.  
  85. {Highlight the line tool}
  86.       UsePen(SOLID,3,0,0,0)
  87.       UseBrush(NULL,0,0,0)
  88.        Gosub Line_Box
  89.        Box_select=1
  90.  
  91. {Draw tools}
  92.        UseFont("Arial",0,3,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  93.        UseBrush(SOLID,255,0,0)
  94.        UsePen(SOLID,2,0,0,0)
  95.  
  96.        DrawText(1,1,"1")    {Line 0 - 15}
  97.        DrawLine(3,2,12,8)
  98.        DrawText(11,8,"2")
  99.  
  100.        DrawText(16,1,"1")      {Rectangle 15 - 30}
  101.       DrawRectangle(18,3,26,12)
  102.       DrawText(26,12,"2")
  103.  
  104.       DrawText(31,1,"1")      {Round Rectangle 30 - 45}
  105.        DrawRoundRectangle(32,3,42,12,3,3)
  106.        DrawText(42,12,"2")
  107.  
  108.        UseBrush(NULL,0,0,0)    {Ellipse 45 - 60}
  109.        UsePen(DOT,1,0,0,0)
  110.        DrawText(46,1,"1")
  111.        DrawRectangle(47,3,58,12)
  112.        DrawText(58,12,"2")
  113.        UseBrush(SOLID,255,0,0)
  114.        UsePen(SOLID,2,0,0,0)
  115.        DrawEllipse(47,3,58,12)
  116.  
  117.        UseBrush(NULL,0,0,0)    {Pie 60 - 75}
  118.        UsePen(DOT,1,0,0,0)
  119.        DrawText(61,1,"1")
  120.        DrawRectangle(62,3,73,12)
  121.        DrawEllipse(62,3,73,12)
  122.        DrawText(73,12,"2")
  123.        UseBrush(SOLID,255,0,0)
  124.        UsePen(SOLID,2,0,0,0)
  125.        DrawPie(62,3,73,12,73,7,63,3)
  126.        DrawText(73,5,"3")
  127.        DrawText(64,0,"4")
  128.  
  129.        UseBrush(NULL,0,0,0)    {Arc 75 - 90}
  130.        UsePen(DOT,1,0,0,0)
  131.        DrawText(77,1,"1")
  132.        DrawRectangle(77,3,88,12)
  133.        DrawEllipse(77,3,88,12)
  134.        DrawText(88,12,"2")
  135.        UseBrush(SOLID,255,0,0)
  136.        UsePen(SOLID,2,0,0,0)
  137.        DrawArc(77,3,88,12,88,7,77,3)
  138.        DrawText(88,5,"3")
  139.        DrawText(79,0,"4")
  140.  
  141.        UseBrush(NULL,0,0,0)    {Chord 90 - 105}
  142.        UsePen(DOT,1,0,0,0)
  143.        DrawText(91,1,"1")
  144.        DrawRectangle(92,3,103,12)
  145.        DrawEllipse(92,3,103,12)
  146.        DrawText(103,10,"2")
  147.        UseBrush(SOLID,255,0,0)
  148.        UsePen(SOLID,2,0,0,0)
  149.        DrawChord(92,3,103,12,103,7,93,3)
  150.        DrawText(103,5,"3")
  151.        DrawText(94,0,"4")
  152.  
  153. {Reset the font}
  154.        UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
  155.  
  156. {Line}
  157. Dr_Line:
  158.        Current_Fig$="&Line"
  159.        Gosub Check_Figure
  160.        If Must_Redraw <> 1 Then Goto Move_Hilite
  161.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  162.                 0,16,60000,130,line2,POS_X,POS_Y)
  163.        Gosub Draw_Blank
  164.        DrawText(25,136,"(1) Click on the beginning of the line")
  165.        WaitInput()
  166. line2:
  167.     GoSub Draw_Hit
  168.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  169.                 0,16,60000,130,line_end,pos_x1,pos_y1)
  170.        Gosub Draw_Blank
  171.        DrawText(25,136,"(2) Click on the end point of the line")
  172.        WaitInput()
  173. line_end:
  174.     GoSub Draw_Hit_1
  175.        DrawLine(pos_x,pos_y,pos_x1,pos_y1)
  176.        Must_Redraw=0
  177.        Goto Dr_Line
  178.  
  179.  
  180. {Rectangle}
  181. dr_rectangle:
  182.        rec_type = 0
  183.        Current_Fig$="&Rectangle"
  184.        goto dr_rect
  185.  
  186. {Round Rectangle}
  187. dr_roundr:
  188.        rec_type = 1
  189.        Current_Fig$ = "&Round Rectangle"
  190.  
  191. Dr_rect:
  192.        Gosub Check_Figure
  193.        If Must_Redraw<>1 Then Goto Move_Hilite
  194.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  195.                 0,16,60000,130,rectangle2,POS_X,POS_Y)
  196.        Gosub Draw_Blank
  197.        DrawText(25,136,"(1) Click on the upper-left corner of the rectangle")
  198.        WaitInput()
  199. rectangle2:
  200.     GoSub Draw_Hit
  201.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  202.               0,16,60000,130,rect_end,pos_x1,pos_y1)
  203.        Gosub Draw_Blank
  204.        DrawText(25,136,"(2) Click on the lower-right corner of the rectangle")
  205.        WaitInput()
  206. rect_end:
  207.     GoSub Draw_Hit_1
  208.        If rec_type = 0 Then DrawRectangle(pos_x,pos_y,pos_x1,pos_y1) | goto dr_rect
  209.        DrawRoundRectangle(pos_x,pos_y,pos_x1,pos_y1,12,9)
  210.        Must_Redraw=0
  211.        Goto dr_rect
  212.  
  213. {Ellipse}
  214. dr_ellipse:
  215.        Current_Fig$ = "&Ellipse"
  216.        Gosub Check_Figure
  217.        If Must_Redraw<>1 Then Goto Move_Hilite
  218.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  219.                 0,16,60000,130,ellipse2,POS_X,POS_Y)
  220.        Gosub Draw_Blank
  221.        DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the ellipse")
  222.        WaitInput()
  223. ellipse2:
  224.     GoSub Draw_Hit
  225.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  226.                0,16,60000,130,ellipse_end,pos_x1,pos_y1)
  227.        Gosub Draw_Blank
  228.        DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the ellipse")
  229.        WaitInput()
  230. ellipse_end:
  231.     GoSub Draw_Hit_1
  232.        DrawEllipse(pos_x,pos_y,pos_x1,pos_y1)
  233.        Must_Redraw=0
  234.        Goto dr_ellipse
  235.  
  236. {Pie}
  237. dr_pie:
  238.        Current_Fig$ = "&Pie"
  239.        Gosub Check_Figure
  240.        If Must_Redraw<>1 Then Goto Move_Hilite
  241.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  242.                 0,16,60000,130,pie2,POS_X,POS_Y)
  243.        Gosub Draw_Blank
  244.        DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the pie's ellipse")
  245.        WaitInput()
  246. pie2:
  247.     GoSub Draw_Hit
  248.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  249.                0,16,60000,130,pie3,pos_x1,pos_y1)
  250.        Gosub Draw_Blank
  251.        DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the pie's ellipse")
  252.        WaitInput()
  253. pie3:
  254.     GoSub Draw_Hit_1
  255.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  256.               0,16,60000,130,pie4,pos_x2,pos_y2)
  257.        Gosub Draw_Blank
  258.        DrawText(25,136,"(3) Click on one end of the arc that defines the pie")
  259.        WaitInput()
  260. pie4:
  261.     GoSub Draw_Hit_2
  262.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  263.                0,16,60000,130,pie_end,pos_x3,pos_y3)
  264.        Gosub Draw_Blank
  265.        DrawText(25,136,"(4) Click on the other end of the arc that defines the pie")
  266.        WaitInput()
  267.  
  268. pie_end:
  269.     GoSub Draw_Hit_3
  270.        DrawPie(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
  271.        Must_Redraw=0
  272.        Goto dr_pie
  273.  
  274. {Arc}
  275. dr_arc:
  276.        Current_Fig$ = "&Arc"
  277.        Gosub Check_Figure
  278.        If Must_Redraw<>1 Then Goto Move_Hilite
  279.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  280.                 0,16,60000,130,arc2,POS_X,POS_Y)
  281.        Gosub Draw_Blank
  282.        DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the arc")
  283.        WaitInput()
  284. arc2:
  285.     GoSub Draw_Hit
  286.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  287.                 0,16,60000,130,arc3,POS_X1,POS_Y1)
  288.        Gosub Draw_Blank
  289.        DrawText(25,136,"(2) Click on the lower-right corner of the rectangle bounding the arc")
  290.        WaitInput()
  291. arc3:
  292.     GoSub Draw_Hit_1
  293.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  294.                 0,16,60000,130,arc4,pos_x2,pos_y2)
  295.        Gosub Draw_Blank
  296.        DrawText(25,136,"(3) Click on the arc's start point")
  297.        WaitInput()
  298. arc4:
  299.     GoSub Draw_Hit_2
  300.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  301.                 0,16,60000,130,arc_end,pos_x3,pos_y3)
  302.        Gosub Draw_Blank
  303.        DrawText(25,136,"(4) Click on the arc's end point")
  304.        WaitInput()
  305.  
  306. arc_end:
  307.     GoSub Draw_Hit_3
  308.        DrawArc(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
  309.        Must_Redraw=0
  310.        Goto dr_arc
  311.  
  312. {Chord}
  313. dr_chord:
  314.        Current_Fig$ = "&Chord"
  315.        Gosub Check_Figure
  316.        If Must_Redraw<>1 Then Goto Move_Hilite
  317.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  318.                 0,16,60000,130,chord2,POS_X,POS_Y)
  319.        Gosub Draw_Blank
  320.        DrawText(25,136,"(1) Click on the upper-left corner of the rectangle bounding the chord's ellipse")
  321.        WaitInput()
  322. chord2:
  323.     GoSub Draw_Hit
  324.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  325.                  0,16,60000,130,chord3,pos_x1,pos_y1)
  326.        Gosub Draw_Blank
  327.        DrawText(25,136,"(2) Click on lower-right corner of the rectangle bounding the chord's ellipse")
  328.        WaitInput()
  329. chord3:
  330.     GoSub Draw_Hit_1
  331.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  332.                  0,16,60000,130,chord4,pos_x2,pos_y2)
  333.        Gosub Draw_Blank
  334.        DrawText(25,136,"(3) Click on one point of the line that defines the chord")
  335.        WaitInput()
  336. chord4:
  337.     GoSub Draw_Hit_2
  338.        SetMouse(0,0,1000,16,Move_Hilite,POS_X,POS_Y,
  339.                 0,16,60000,130,chord_end,pos_x3,pos_y3)
  340.        Gosub Draw_Blank
  341.        DrawText(25,136,"(4) Click on the second point of the line that defines the chord")
  342.        WaitInput()
  343.  
  344. chord_end:
  345.     GoSub Draw_Hit_3
  346.        DrawChord(pos_x,pos_y,pos_x1,pos_y1,pos_x2,pos_y2,pos_x3,Pos_y3)
  347.        Must_Redraw=0
  348.        Goto dr_chord
  349.  
  350. {Change Brush Colors}
  351. BRUSH_WHITE:
  352.        Current_Brush$ = "&White"
  353.        Gosub Check_Brush
  354.        UseBrush(SOLID,255,255,255)
  355.        Br_Red=255
  356.        Br_Green=255
  357.        Br_Blue=255
  358.        Goto Leave_Box
  359.  
  360. BRUSH_GRAY:
  361.        Current_Brush$ = "&Gray"
  362.        Gosub Check_Brush
  363.        UseBrush(SOLID,192,192,192)
  364.        Br_Red=192
  365.        Br_Green=192
  366.        Br_Blue=192
  367.        Goto Leave_Box
  368.  
  369. BRUSH_RED:
  370.        Current_Brush$ = "&Red"
  371.        Gosub Check_Brush
  372.        UseBrush(SOLID,255,0,0)
  373.        Br_Red=255
  374.        Br_Green=0
  375.        Br_Blue=0
  376.        Goto Leave_Box
  377.  
  378. BRUSH_YEL:
  379.        Current_Brush$ = "&Yellow"
  380.        Gosub Check_Brush
  381.        UseBrush(SOLID,255,255,0)
  382.        Br_Red=255
  383.        Br_Green=255
  384.        Br_Blue=0
  385.        Goto Leave_Box
  386.  
  387. BRUSH_GRN:
  388.        Current_Brush$ = "Gree&n"
  389.        Gosub Check_Brush
  390.        UseBrush(SOLID,0,255,0)
  391.        Br_Red=0
  392.        Br_Green=255
  393.        Br_Blue=0
  394.        Goto Leave_Box
  395.  
  396. BRUSH_LTBLU:
  397.        Current_Brush$ = "&Light Blue"
  398.        Gosub Check_Brush
  399.        UseBrush(SOLID,0,255,255)
  400.        Br_Red=0
  401.        Br_Green=255
  402.        Br_Blue=255
  403.        Goto Leave_Box
  404.  
  405. BRUSH_BLUE:
  406.        Current_Brush$ = "&Blue"
  407.        Gosub Check_Brush
  408.        UseBrush(SOLID,0,0,255)
  409.        Br_Red=0
  410.        Br_Green=0
  411.        Br_Blue=255
  412.        Goto Leave_Box
  413.  
  414. BRUSH_PINK:
  415.        Current_Brush$ = "&Pink"
  416.        Gosub Check_Brush
  417.        UseBrush(SOLID,255,0,255)
  418.        Br_Red=255
  419.        Br_Green=0
  420.        Br_Blue=255
  421.        Goto Leave_Box
  422.  
  423. BRUSH_Black:
  424.        Current_Brush$ = "Blac&k"
  425.        Gosub Check_Brush
  426.        UseBrush(SOLID,0,0,0)
  427.        Br_Red=0
  428.        Br_Green=0
  429.        Br_Blue=0
  430.        Goto Leave_Box
  431.  
  432. {Change Pen Colors}
  433. Pen_White:
  434.        Current_Pen$="&White "
  435.        Gosub Check_Pen
  436.        UsePen(SOLID,2,255,255,255)
  437.        P_Red=255
  438.        P_Green=255
  439.        P_Blue=255
  440.        Goto Leave_Box
  441.  
  442. Pen_GRAY:
  443.        Current_Pen$="&Gray "
  444.        Gosub Check_Pen
  445.        UsePen(SOLID,2,192,192,192)
  446.        P_Red=192
  447.        P_Green=192
  448.        P_Blue=192
  449.        Goto Leave_Box
  450.  
  451. Pen_RED:
  452.        Current_Pen$="&Red "
  453.        Gosub Check_Pen
  454.        UsePen(SOLID,2,255,0,0)
  455.        P_Red=255
  456.        P_Green=0
  457.        P_Blue=0
  458.        Goto Leave_Box
  459.  
  460. Pen_YEL:
  461.        Current_Pen$="&Yellow "
  462.        Gosub Check_Pen
  463.        UsePen(SOLID,2,255,255,0)
  464.        P_Red=255
  465.        P_Green=255
  466.        P_Blue=0
  467.        Goto Leave_Box
  468.  
  469. Pen_GRN:
  470.        Current_Pen$="Gree&n "
  471.        Gosub Check_Pen
  472.        UsePen(SOLID,2,0,255,0)
  473.        P_Red=0
  474.        P_Green=255
  475.        P_Blue=0
  476.        Goto Leave_Box
  477.  
  478. Pen_LTBLU:
  479.        Current_Pen$="&Light Blue "
  480.        Gosub Check_Pen
  481.        UsePen(SOLID,2,0,255,255)
  482.        P_Red=0
  483.        P_Green=255
  484.        P_Blue=255
  485.        Goto Leave_Box
  486.  
  487. Pen_BLUE:
  488.        Current_Pen$="&Blue "
  489.        Gosub Check_Pen
  490.        UsePen(SOLID,2,0,0,255)
  491.        P_Red=0
  492.        P_Green=0
  493.        P_Blue=255
  494.        Goto Leave_Box
  495.  
  496. Pen_PINK:
  497.        Current_Pen$="&Pink "
  498.        Gosub Check_Pen
  499.        UsePen(SOLID,2,255,0,255)
  500.        P_Red=255
  501.        P_Green=0
  502.        P_Blue=255
  503.        Goto Leave_Box
  504.  
  505. Pen_Black:
  506.       Current_Pen$="Blac&k "
  507.        Gosub Check_Pen
  508.        UsePen(SOLID,2,0,0,0)
  509.        P_Red=0
  510.        P_Green=0
  511.        P_Blue=0
  512.        Goto Leave_Box
  513.  
  514. {Subroutine to erase current text}
  515. Draw_Blank:
  516.        UsePen(NULL,1,0,0,0)
  517.        UseBrush(SOLID,255,255,255)
  518.        DrawRectangle(25,136,250,145)
  519.        UsePen(SOLID,2,P_Red,P_Green,P_Blue)
  520.        UseBrush(SOLID,Br_Red,Br_Green,Br_Blue)
  521.        Return
  522.  
  523. {Move the highlight to the selected tool}
  524. Move_Hilite:
  525.        Box_Select_Old = Box_Select
  526.        UseBrush(NULL,0,0,0)
  527.  
  528. {Erase the old highlight}
  529.        UsePen(SOLID,3,255,255,255)   {White pen}
  530.        If Box_Select_Old = 1 Then Gosub Line_Box | Goto New_Hilite
  531.        If Box_Select_Old = 2 Then Gosub Rect_Box | Goto New_Hilite
  532.        If Box_Select_Old = 3 Then Gosub RoundRect_Box | Goto New_Hilite
  533.        If Box_Select_Old = 4 Then Gosub Ellipse_Box | Goto New_Hilite
  534.        If Box_Select_Old = 5 Then Gosub Pie_Box | Goto New_Hilite
  535.        If Box_Select_Old = 6 Then Gosub Arc_Box | Goto New_Hilite
  536.              {Else} Gosub Chord_Box
  537.  
  538. {Draw the new highlight}
  539. New_Hilite:
  540.        UsePen(SOLID,3,0,0,0)      {Black pen}
  541.        If Must_Redraw <> 1 Then GoSub Key_Hilite
  542.        If POS_X <= 15 Then Box_Select=1 | Gosub Line_Box | Goto Leave_Box
  543.        If POS_X <= 30 Then Box_Select=2 | Gosub Rect_Box | Goto Leave_Box
  544.        If POS_X <= 45 Then Box_Select=3 | Gosub RoundRect_Box | Goto Leave_Box
  545.        If POS_X <= 60 Then Box_Select=4 | Gosub Ellipse_Box | Goto Leave_Box
  546.        If POS_X <= 75 Then Box_Select=5 | Gosub Pie_Box | Goto Leave_Box
  547.        If POS_X <= 90 Then Box_Select=6 | Gosub Arc_Box | Goto Leave_Box
  548.        {Else} Box_Select=7 | Gosub Chord_Box | Goto Leave_Box
  549.  
  550. Key_Hilite:
  551.        If Current_Fig$="&Line" Then Box_Select=1 | Gosub Line_Box | Goto Leave_Box
  552.        If Current_Fig$="&Rectangle" Then Box_Select=2 | Gosub Rect_Box | Goto Leave_Box
  553.        If Current_Fig$="&Round Rectangle" Then Box_Select=3 | Gosub RoundRect_Box | Goto Leave_Box
  554.        If Current_Fig$="&Ellipse" Then Box_Select=4 | Gosub Ellipse_Box | Goto Leave_Box
  555.        If Current_Fig$="&Pie" Then Box_Select=5 | Gosub Pie_Box | Goto Leave_Box
  556.        If Current_Fig$="&Arc" Then Box_Select=6 | Gosub Arc_Box | Goto Leave_Box
  557.        Box_Select=7 | Gosub Chord_Box
  558.  
  559. {Rethe brush and pen and branch to the appropriate routine}
  560. Leave_Box:
  561.        Gosub Draw_Boxes
  562.        If Box_Select = 1 Then Goto Dr_Line
  563.        If Box_Select = 2 Then Goto Dr_Rectangle
  564.        If Box_Select = 3 Then Goto Dr_RoundR
  565.        If Box_Select = 4 Then Goto Dr_Ellipse
  566.        If Box_Select = 5 Then Goto Dr_Pie
  567.        If Box_Select = 6 Then Goto Dr_Arc
  568.          {Else} Goto Dr_Chord
  569.  
  570. Exit_Proc:
  571.     SetMenu()
  572.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  573.     UseCoordinates(PIXEL)
  574.     DrawShadeRectangle(cx1,cy1,cx2,cy2, 0,0,0, 0,0,255, TOPBOTTOM)
  575.     UseFont("Arial",15,31,NOBOLD,NOITALIC,NOUNDERLINE,255,255,255)
  576.     UseBackground(TRANSPARENT,0,0,0)
  577.     DrawTextExt(20,20,400,300,
  578. "32 bit PiXCL Tools is fully compatible with Windows 95,
  579. NT 3.51 and NT 4.0",CENTER)
  580.  
  581.     MessageBox(OK,1,INFORMATION,
  582. "This sample drawing program showed you the capabilities of the 
  583. direct access PiXCL 4.0 has on to your Windows screen, using the
  584. mouse as the input device. 
  585.  
  586. All the screen draw functions are available to you on a programmed 
  587. basis, this is, without the need for input from the mouse or keyboard.
  588.  
  589. You can also read input data from files, or transfer ascii data from
  590. the ClipBoard to your drawing routines.",
  591.     "Graphics Drawing is programable too !",Res)
  592.        End
  593.  
  594. {Subroutines for highlighting drawing tools}
  595. Line_Box:
  596.        DrawRectangle(0,0,15,16)
  597.        Return
  598.  
  599. Rect_Box:
  600.        DrawRectangle(15,0,30,16)
  601.        Return
  602.  
  603. RoundRect_Box:
  604.        DrawRectangle(30,0,45,16)
  605.        Return
  606.  
  607. Ellipse_Box:
  608.        DrawRectangle(45,0,60,16)
  609.        Return
  610.  
  611. Pie_Box:
  612.        DrawRectangle(60,0,75,16)
  613.        Return
  614.  
  615. Arc_Box:
  616.        DrawRectangle(75,0,90,16)
  617.        Return
  618.  
  619. Chord_Box:
  620.       DrawRectangle(90,0,105,16)
  621.        Return
  622.  
  623. {Subroutine: Draw tool boxes}
  624. Draw_Boxes:
  625.     WinGetClientRect("",cx1,cy1,cx2,cy2)
  626.        UsePen(SOLID,2,0,0,0)
  627.        DrawLine(0,16,1000,16)     {Solid line across the window}
  628.        UsePen(SOLID,1,0,0,0)      {Lines between drawing tools}
  629.  
  630.        DrawLine(15,0,15,16)
  631.        DrawLine(30,0,30,16)
  632.        DrawLine(45,0,45,16)
  633.        DrawLine(60,0,60,16)
  634.        DrawLine(75,0,75,16)
  635.        DrawLine(90,0,90,16)
  636. {Reset the pen and brush}
  637.        UsePen(SOLID,2,P_Red,P_Green,P_Blue)
  638.        UseBrush(SOLID,Br_Red,Br_Green,Br_Blue)
  639.        Return
  640.  
  641. { Check the selected graphic figure }
  642. Check_Figure:
  643.       StrCmp(Current_Fig$,Previous_Fig$,Must_Redraw)
  644.        ChangeMenuItem(Previous_Fig$,UNCHECK,temp)
  645.        Previous_Fig$=Current_Fig$
  646.        ChangeMenuItem(Current_Fig$,CHECK,temp)
  647.        Return
  648.  
  649. { Check the selected pen }
  650. Check_Pen:
  651.        ChangeMenuItem(Previous_Pen$,UNCHECK,temp)
  652.        Previous_Pen$=Current_Pen$
  653.        ChangeMenuItem(Current_Pen$,CHECK,temp)
  654.        Return
  655.       
  656. { Check the selected brush }
  657. Check_Brush:
  658.        ChangeMenuItem(Previous_Brush$,UNCHECK,temp)
  659.        Previous_Brush$=Current_Brush$
  660.        ChangeMenuItem(Current_Brush$,CHECK,temp)
  661.        Return
  662.  
  663. {=== subroutine: draw a ╫ at the mouse hit co-ordinate ===}
  664. Draw_Hit:
  665.     X = Pos_X  Y = Pos_Y - 3
  666.     DrawText(X,Y,"╫")
  667.     Return
  668.  
  669. Draw_Hit_1:
  670.     X = Pos_X1  Y = Pos_Y1 - 3
  671.     DrawText(X,Y,"╫")
  672.     Return
  673.  
  674. Draw_Hit_2:
  675.     X = Pos_X2  Y = Pos_Y2 - 3
  676.     DrawText(X,Y,"╫")
  677.     Return
  678.  
  679. Draw_Hit_3:
  680.     X = Pos_X3  Y = Pos_Y3 - 3
  681.     DrawText(X,Y,"╫")
  682.     Return
  683.  
  684.  
  685.